﻿@using Inovout.Descriptor
@model IEnumerable<KuaJing.Orders.Domain.Order>

<div class="iui-panel">
    <h1>订单查询</h1>
    <div class="row form-inline">
        @using (Html.BeginForm("Report", "Order", new { fileId = ViewBag.FileId }))
        {
            <div class="col-md-10">
                @Html.Query()
            </div>
            <div class="col-md-2">
                @Html.Submit("查询", new { @class = "btn btn-default btn-primary" })
            </div>
        }
    </div>
</div>
<div class="row">
   @{ 
       var route = new RouteValueDictionary();
   }
     @Html.ActionLink("下载聚类分析数据结果", "ExportCsv",
    QueryCriteriaHelper.BuildRouteDictionary(Html.ViewData.GetQueryCriteria(Model), route))
</div>
<div class="row">
    <div class="col-xs-4 chart">
        {
        "chart":
        {
        "type": "pie",
        "options3d":
        { "enabled": true, "alpha": 45, "beta": 0 }
        },
        "title": { "text": "订单状态数量统计" },
        "tooltip": { "pointFormat": "订单数:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
        "plotOptions": {
        "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y}\/{point.total}" } } },
        "series": [{ "type": "pie", "name": "订单数占比", "data": @ViewBag.StatusCountReportData,
        "events":{"click": function(event) { }}
        }]
        }
    </div>
    <div class="col-xs-4 chart">
        {
        "chart":
        {
        "type": "pie",
        "options3d":
        { "enabled": true, "alpha": 45, "beta": 0 }
        },
        "title": { "text": "订单状态金额统计<br />单位:亿元" },
        "tooltip": { "pointFormat": "订单金额:{point.y:.2f}\/{point.total:.2f}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
        "plotOptions": {
        "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y:.2f}\/{point.total:.2f}" } } },
        "series": [{ "type": "pie", "name": "订单金额占比", "data": @ViewBag.StatusAmountReportData
        }]
        }
    </div>
</div>
<div class="row">
    @foreach (var kv in (IDictionary<string, string>)ViewBag.ProviderStatusCountReportDatas)
    {
        <div class="col-xs-4 chart">
            {
            "chart":
            {
            "type": "pie",
            "options3d":
            { "enabled": true, "alpha": 45, "beta": 0 }
            },
            "title": { "text": "@kv.Key 订单状态数量统计" },
            "tooltip": { "pointFormat": "订单数:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
            "plotOptions": {
            "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y}\/{point.total}" } } },
            "series": [{ "type": "pie", "name": "订单数占比", "data": @kv.Value,
            "events":{"click": function(event) { }}
            }]
            }
        </div>
    }
</div>
<div class="row">
    @foreach (var kv in (IDictionary<string, string>)ViewBag.providerStatusAmountReportDatas)
    {
        <div class="col-xs-4 chart">
            {
            "chart":
            {
            "type": "pie",
            "options3d":
            { "enabled": true, "alpha": 45, "beta": 0 }
            },
            "title": { "text": "@kv.Key 订单状态金额统计<br />单位:亿元" },
            "tooltip": { "pointFormat": "订单金额:{point.y:.2f}\/{point.total:.2f}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
            "plotOptions": {
            "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y:.2f}\/{point.total:.2f}" } } },
            "series": [{ "type": "pie", "name": "订单金额占比", "data": @kv.Value
            }]
            }
        </div>
    }
</div>

<div class="row">
    <div class="col-xs-4 chart">
        {
        "chart":
        {
        "type": "pie",
        "options3d":
        { "enabled": true, "alpha": 45, "beta": 0 }
        },
        "title": { "text": "退税服务订单数量统计" },
        "tooltip": { "pointFormat": "订单数:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
        "plotOptions": {
        "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y}\/{point.total}" } } },
        "series": [{ "type": "pie", "name": "订单数占比", "data": @ViewBag.DrawbackProductCountReportData
        }]
        }
    </div>
    <div class="col-xs-4 chart">
        {
        "chart":
        {
        "type": "pie",
        "options3d":
        { "enabled": true, "alpha": 45, "beta": 0 }
        },
        "title": { "text": "退税服务预计收益统计<br />单位:万元" },
        "tooltip": { "pointFormat": "收益金额:{point.y}\/{point.total:.2f}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
        "plotOptions": {
        "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y:.2f}\/{point.total:.2f}" } } },
        "series": [{ "type": "pie", "name": "收益金额占比", "data": @ViewBag.DrawbackProductAmountReportData
        }]
        }
    </div>
</div>
<div class="tabs" style="height:900px;;width:100%">
    @foreach (var report in (Dictionary<string, Dictionary<string, string>>)ViewBag.OrderReports)
    {
    <div title="@report.Key">
        <div class="row">
            <div class="col-xs-12 chart">
                {
                title: {
                text: '订单与客户数量趋势图',
                x: -20 //center
                },
                subtitle: {
                text: '@report.Key',
                x: -20
                },
                xAxis: {
                categories: @Html.Raw(report.Value["OrderCountReport_Ccategories"])
                },
                yAxis: {
                title: {
                text: '数量'
                },
                plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
                }]
                },
                tooltip: {
                valueSuffix: '个'
                },
                legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'middle',
                borderWidth: 0
                },
                plotOptions: { line: { dataLabels: { enabled: true },
                enableMouseTracking: false}},
                series: @Html.Raw(report.Value["OrderCountReport_Series"])
                }
            </div>
        </div>

        <div class="row">
            <div class="col-xs-12 chart">
                {
                title: {
                text: '订单金额趋势图',
                x: -20 //center
                },
                subtitle: {
                text: '@report.Key',
                x: -20
                },
                xAxis: {
                categories: @Html.Raw(report.Value["OrderAmountReport_Ccategories"])
                },
                yAxis: {
                title: {
                text: '金额'
                },
                plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
                }]
                },
                tooltip: {
                valueSuffix: '万元'
                },
                legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'middle',
                borderWidth: 0
                },
                plotOptions: { line: { dataLabels: { enabled: true , format: "{point.y:.2f}"},
                enableMouseTracking: false}},
                series: @Html.Raw(report.Value["OrderAmountReport_Series"])
                }
            </div>>
        </div>
    </div>
    }
</div>


<div class="tabs" style="height:950px;width:100%">
    @{
        var orderCountBi = (Dictionary<int, string>)ViewBag.OrderCountBi;
        var orderAmountBi = (Dictionary<int, string>)ViewBag.OrderAmountBi;
        var orderAmountCountBi = (Dictionary<int, string>)ViewBag.OrderAmountCountBi;
    }
    @foreach (var key in (IEnumerable<int>)ViewBag.KeysBi)
    {
        <div title="@key">
            <div class="row">
                <div class="col-xs-12 chart">
                    {
                    "chart":
                    {
                    "type": "pie",
                    "options3d":
                    { "enabled": true, "alpha": 45, "beta": 0 }
                    },
                    "title": { "text": "订单金额聚类分析<br />单位:万元" },
                    "tooltip": { "pointFormat": "订单金额:<br />{point.name:.2f}万元<br />订单数量：{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
                    "plotOptions": {
                    "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35,
                    "dataLabels": { "enabled": true, "format": "{point.name}<br />订单数量:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" } } },
                    "series": [{ "type": "pie", "name": "订单数量占比",
                    "data": @orderAmountBi[key]
                    }]
                    }
                </div>

                <div class="col-xs-12 chart">
                    {
                    "chart":
                    {
                    "type": "pie",
                    "options3d":
                    { "enabled": true, "alpha": 45, "beta": 0 }
                    },
                    "title": { "text": "单客户订单数量聚类分析" },
                    "tooltip": { "pointFormat": "订单数量：{point.name}<br />客户数量:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
                    "plotOptions": {
                    "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35,
                    "dataLabels": { "enabled": true, "format": "{point.name}<br />客户数量：{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" } } },
                    "series": [{ "type": "pie", "name": "客户数量占比",
                    "data": @orderCountBi[key]
                    }]
                    }
                </div>

                <div class="col-xs-12 chart">
                    {
                    "chart":
                    {
                    "type": "pie",
                    "options3d":
                    { "enabled": true, "alpha": 45, "beta": 0 }
                    },
                    "title": { "text": "单客户订单金额与数量聚类分析" },
                    "tooltip": { "pointFormat": "订单金额与数量：{point.name}<br />客户数量:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
                    "plotOptions": {
                    "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35,
                    "dataLabels": { "enabled": true, "format": "单客户订单金额与数量：<br />{point.name}<br />客户数量：{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" } } },
                    "series": [{ "type": "pie", "name": "客户数量占比",
                    "data": @orderAmountCountBi[key]
                    }]
                    }
                </div>

            </div>
        </div>
    }
</div>

